#pragma once
#include <game/Config.h>

#include <memory>
#include <Atom.h>
#include <map>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>

namespace liba {
class Object2D;
} // namespace liba

ARELLO_GAME_NAMESPACE_DECL_START
namespace controls {
class Control;

typedef boost::function<boost::shared_ptr<Control> (const liba::Atom&, liba::Object2D*)> ControlCreator;

class ControlFactory
{
public:
	ControlFactory();

	void Register(const std::string& name, ControlCreator creator);
	boost::shared_ptr<Control> Create(const std::string& name, const liba::Atom& controlName, liba::Object2D* obj2d) const;
	bool IsValidControlName(const std::string& name) const;
private:
	std::map<std::string, ControlCreator> creators;
};

} // namespace controls
ARELLO_GAME_NAMESPACE_DECL_END